package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qf.mapper.DtsRoleMapper;
import com.qf.pojo.DtsRole;
import com.qf.service.DtsRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

@Service
public class DtsRoleServiceImpl implements DtsRoleService {
    @Resource
    DtsRoleMapper roleMapper;
    @Override
    public Set<String> findByRoleIds(Integer[] roleIds) {

        List<DtsRole> roles = roleMapper.selectList(new LambdaQueryWrapper<DtsRole>().select(DtsRole::getName).in(DtsRole::getId, roleIds).eq(DtsRole::getDeleted, false));
        return roles.stream().map(DtsRole::getName).collect(Collectors.toSet());
    }
}
